#include <iostream>
using namespace std;

// 重载 << 作为类的 friend 有元函数（重载函数）  
class Computer
{
public:
    Computer(int real, int image)
    :_real(real)
    ,_image(image)
    {  }

    // 作为friend
    friend 
        ostream & operator<<(ostream & os, Computer & rhs);
private:
    int _real;
    int _image;
};
ostream & operator<<(ostream & os, Computer & rhs){
    os << "_real=" << rhs._real<< " " << "_image=" << rhs._image << endl;
    return os;
}

void test(){
    Computer p(1,2);
    cout << p;
}

int main(int atgc, char * argv[])
{
    test();
    return 0;
}

